package com.wman.mvp.ui.activity.welcome

import com.wman.mvp.http.HttpUtils
import com.wman.mvp.http.ResponseListener
import com.wman.mvp.http.UserApi
import com.wman.mvp.mvp.model.BaseModel
import com.wman.mvp.mvp.presenter.BasePresenter

/**
 * @ProjectName: wman
 * @Package: com.wman.mvp.ui.activity.welcome
 * @ClassName: MvpWelcomePresenter
 * @Description: java类作用描述
 * @Author: wman
 * @CreateDate: 2020/1/2 16:52
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/1/2 16:52
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
class MvpWelcomePresenter : BasePresenter<MvpWelcomeView>() {
    fun setText(content: String) {
        getBaseView()!!.setData(content)
    }

    fun getText() {
        HttpUtils.sendHttp(HttpUtils.createApi(UserApi::class.java).getTest("28654780"), object : ResponseListener<BaseModel<MvpWelcomeModel>> {
            override fun <T> onSuccess(data: T) {
                if (data != null) {
                    getBaseView()?.setData(data)
                }
            }

            override fun onFail(err: String) {
                getBaseView()?.setError(err)
            }
        })
    }
}